﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.Drawing;
using System.Drawing.Imaging;

namespace LowLevelGraphics.SeamCarving
{
    /// <summary>
    /// Luminance as an energy function
    /// </summary>
    public sealed class Luminance : EnergyFunction
    {
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public override string ToString()
        {
            return "Luminance";
        }

        /// <summary>
        /// Recompute
        /// </summary>
        /// <param name="bmd"></param>
        /// <param name="size"></param>
        public override void Recompute(BitmapData bmd, Size size)
        {
            if (bmd != null)
            {
                EnergyMap = new byte[bmd.Width, bmd.Height];
                for (int x = 0; x < bmd.Width; x++)
                    for (int y = 0; y < bmd.Height; y++)
                    {
                        // Use luminance for energy value
                        EnergyMap[x, y] = GetEnergyValue(bmd, size, x, y);
                    }
            }
        }

        //TODO: check if this really has to be empty here...
        /// <summary>
        /// Recompute a seem
        /// </summary>
        /// <param name="bmd"></param>
        /// <param name="size"></param>
        /// <param name="seam"></param>
        public override void RecomputeSeam(BitmapData bmd, Size size, Seam seam)
        {
            return;
        }
    }
}
